package com.vstudy.zx.utils.page;

public abstract class Page {
    private Long pageIndex = 1L;
    private Integer pageSize = 5;
    private Long totalCount;
    private Long pageCount;  // 计算 get  依赖totalCount

    private String url;

    private Long skip; // 分页查询  计算 get

    public Long getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Long pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Long getPageCount() {
        return totalCount % pageSize == 0 ? totalCount / pageSize : (totalCount / pageSize + 1);
    }

//    public void setPageCount(Integer pageCount) {
//        this.pageCount = pageCount;
//    }

    public Long getSkip() {
        return Long.valueOf((pageIndex - 1) * pageSize);
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
